var Main = {
    data() {
        return {
            input: '',
            form: {
                title: '',
                content: '',
                userid: 1
            }
        }
    },
    mounted() {
        this.initEditor()
    },
    methods: {
        initEditor() {
            UE.getEditor('content', {
                autoHeightEnabled: true,
                autoFloatEnabled: true,
                initialFrameHeight: 283,
                toolbars: [
                    ['source', 'undo', 'redo', 'bold', 'emotion', 'insertvideo', 'insertimage', 'simpleupload', 'link']
                ]
            });
        },
        onPost() {
            let that = this;
            this.form.content = UE.getEditor('content').getContent();
            $.ajax({
                url: "post",
                type: 'post',
                data: this.form,
                dataType: 'json',
                success: function (data) {
                    console.log(data);
                    if (data.code == 1) {
                        that.$message({
                            message: '发表成功',
                            type: 'success'
                        });
                        location.href = data.url
                    } else {
                        that.$message.error(res.data.msg);
                    }
                }
            });
        }
    }
}
var Ctor = Vue.extend(Main)
new Ctor().$mount('#app')